package com.tmt.sm.impl;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class SendResult {

    private String sender;

    private int resultCode;

    private String resultMsg;

    /**
     * 短信发送返回的原始数据。
     */
    private String originResult;

    private boolean success;

    public SendResult(){}

    public SendResult(String sender, int code, String msg, boolean success){
        this.sender = sender;
        this.resultCode = code;
        this.resultMsg = msg;
        this.success = success;
    }

    public SendResult(String sender, int code, String msg, String origin, boolean success){
        this.sender = sender;
        this.resultCode = code;
        this.resultMsg = msg;
        this.originResult = origin;
        this.success = success;
    }

    public static SendResult success(String sender, int code, String msg){
        return new SendResult(sender, code, msg, true);
    }

    public static SendResult failure(String sender, int code, String msg){
        return new SendResult(sender, code, msg, false);
    }

    public static SendResult success(String sender, int code, String msg, String origin){
        return new SendResult(sender, code, msg, origin, true);
    }

    public static SendResult failure(String sender, int code, String msg, String origin){
        return new SendResult(sender, code, msg, origin, false);
    }
}
